package source;

import source.view.*;
import java.awt.Color;

public class Item {
	private ItemType iType;
	private String picture;
	private boolean isOneShot;
	private boolean isMineable;
	private boolean isPassable;
	
	private int ore;
	
	public Item(ItemType stats) {
		this.picture = stats.getPicture();
		this.isPassable = stats.getIsPassable();
		this.isMineable = stats.getIsMineable();
		this.isOneShot = stats.getIsOneShot();
		this.ore = stats.getOre();
		this.iType = stats;
	}
	
//	/**
//	 * Returns <tt>true</tt> if the item is mineable.
//	 * @return
//	 */
//	public boolean getIsMineable() {
//		return isMineable;
//	}
	
	/**
	 * Returns the location of the picture for the item.
	 * @return
	 */
	public String getPicture() {
		return picture;
	}
	
	/** 
	 * Returns whether the item is a one shot item.
	 * @return
	 */
	public boolean getIsOneShot() {
		return this.isOneShot;
	}
	
	/**
	 * Returns <tt>true</tt> whether the item is an obstacle.
	 * @return
	 */
	public boolean getIsPassable() {
		return isPassable;
	}
	
	/**
	 * Returns the type of item.
	 * @return
	 */
	public ItemType getType() {
		return this.iType;
	}
	
	/**
	 * Performs an action to the player's status based upon what type the 
	 * object is.
	 * @param s
	 * @return whether the operation was successful.
	 */
	public boolean takeAction(PlayerStatus s) {
		switch(this.iType) {
		
		case BONUSORE:
			MainScreen.writeToConsole("Item: Player found extra ore", Color.GREEN);
			s.modifyOre(ore);
			return true;
			
		default:
			return false;
		}
	}
}
